<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>09_super继承</title>
</head>

<body>
    <script>
        class Phone {
            constructor(brand, price) {
                this.brand = brand
                this._price = price
            }

            get price() {
                console.log('价格属性被读取了')
                return this._price
            }

            set price(price) {
                console.log('价格属性被设置了')
                this._price = price
            }

            call() {
                console.log('我可以打电话')
            }

        }

        class SmartPhone extends Phone {
            constructor(brand, price, color, size) {
                super(brand, price)
                this.color = color
                this.size = size
            }

            photo() {
                console.log('我可以拍照')
            }

            playGame() {
                console.log('玩游戏')
            }

            call() {
                console.log('我可以进行视频通话')
            }
        }

        const xiaomi = new SmartPhone('小米', 2499, '黑色', '4.7inch')

        console.log(xiaomi)
        xiaomi.call()
        xiaomi.photo()
        xiaomi.playGame()

        console.log(xiaomi.price)

        class Num {
            constructor(num) {
                this._num = num;
            }

            get num() {
                return this._num;
            }

            set num(num) {
                this._num = num;
            }

        }

        var test = new Num(9);
        console.log(test.num);
        test.num = 99;
        console.log(test.num);

    </script>
</body>

</html>